namespace OracleInternal.BinXml
{
	internal class AttributeInfo
	{
		private ObxmlNodeState m_nodeState;

		private string m_attributeValue;

		internal bool IsNamespaceAttribute;

		internal string Prefix;

		internal ulong PrefixId;

		private PrefixInfo m_PrefixInfo;

		private string m_AttributeString;

		private string m_LocalName;

		private string m_NameSpace;

		private string m_QualifiedName;

		internal string Value
		{
			get
			{
				return m_attributeValue;
			}
			set
			{
				if (1 == (ObxmlDecodeContext.m_XMLTypeOptimizationLevel & 1))
				{
					m_attributeValue = value;
				}
				else if (value != null)
				{
					m_attributeValue = value.ReplaceXmlChars();
				}
				else
				{
					m_attributeValue = null;
				}
			}
		}

		public AttributeInfo()
		{
			m_nodeState = null;
			IsNamespaceAttribute = false;
			PrefixId = 0uL;
			Value = string.Empty;
			m_LocalName = string.Empty;
			m_NameSpace = string.Empty;
			m_PrefixInfo = null;
			Prefix = string.Empty;
			m_AttributeString = null;
			m_QualifiedName = null;
		}

		internal AttributeInfo ResetAttributeInfo(ObxmlDecodeState decodeState, ObxmlNodeState nodeState, bool isNamespaceAttribute, ulong pfxid, string localname, string nameSpace, string value)
		{
			m_QualifiedName = null;
			m_PrefixInfo = null;
			m_nodeState = nodeState;
			IsNamespaceAttribute = isNamespaceAttribute;
			PrefixId = pfxid;
			Value = value;
			m_LocalName = localname;
			m_NameSpace = nameSpace;
			m_PrefixInfo = null;
			Prefix = string.Empty;
			m_AttributeString = null;
			return this;
		}

		internal AttributeInfo ResetAttributeInfo(ObxmlDecodeState decodeState, ObxmlNodeState nodeState, bool isNamespaceAttribute, PrefixInfo pfxInfo, string localname, string nmspace, string value)
		{
			m_attributeValue = null;
			m_nodeState = nodeState;
			IsNamespaceAttribute = isNamespaceAttribute;
			m_PrefixInfo = pfxInfo;
			PrefixId = (ulong)((m_PrefixInfo == null) ? 0 : m_PrefixInfo.PrefixId);
			Value = value;
			m_LocalName = localname;
			m_NameSpace = nmspace;
			Prefix = string.Empty;
			m_AttributeString = null;
			m_QualifiedName = null;
			return this;
		}

		internal AttributeInfo ResetAttributeInfo(ObxmlDecodeState decodeState, ObxmlNodeState nodeState, bool isNamespaceAttribute, string prefix, string localname, string nmspace, string value)
		{
			m_nodeState = nodeState;
			IsNamespaceAttribute = isNamespaceAttribute;
			Prefix = prefix;
			m_PrefixInfo = null;
			PrefixId = 0uL;
			Value = value;
			m_LocalName = localname;
			m_NameSpace = nmspace;
			m_AttributeString = null;
			m_QualifiedName = null;
			return this;
		}

		internal string GetQualifiedName(ObxmlDecodeState decodeState)
		{
			if (!string.IsNullOrEmpty(m_QualifiedName))
			{
				return m_QualifiedName;
			}
			if (!string.IsNullOrEmpty(Prefix))
			{
				Prefix.Trim();
			}
			string prefix = Prefix;
			if (string.IsNullOrEmpty(prefix) && m_PrefixInfo != null)
			{
				prefix = m_PrefixInfo.Prefix;
			}
			if (!string.IsNullOrEmpty(prefix))
			{
				return GetQualifiedName(prefix, GetLocalName(decodeState));
			}
			ulong num = PrefixId;
			if (num == 0 && m_PrefixInfo != null && m_PrefixInfo.PrefixId > 0)
			{
				num = (ulong)m_PrefixInfo.PrefixId;
			}
			if (num != 0)
			{
				prefix = decodeState.GetPrefix((short)num);
			}
			return GetQualifiedName(prefix, GetLocalName(decodeState));
		}

		internal string GetQualifiedName(string prefix, string localName)
		{
			if (!string.IsNullOrEmpty(prefix))
			{
				if (!string.IsNullOrEmpty(localName))
				{
					return m_QualifiedName = prefix + ":" + localName;
				}
				return m_QualifiedName = prefix;
			}
			return m_QualifiedName = localName;
		}

		internal PrefixInfo GetPrefixInfo(ObxmlDecodeState decodeState, bool refetchPrefixInfo = false)
		{
			return PrefixInfo.GetPrefixInfo(decodeState, PrefixId, m_PrefixInfo, refetchPrefixInfo);
		}

		internal string GetLocalName(ObxmlDecodeState decodeState)
		{
			if (m_LocalName != null)
			{
				return m_LocalName;
			}
			return string.Empty;
		}

		internal string GetNamespace(ObxmlDecodeState decodeState)
		{
			if (m_NameSpace != null)
			{
				return m_NameSpace;
			}
			m_NameSpace = decodeState.GetNamespace(m_nodeState.m_ElementToken.NamespaceId);
			return m_NameSpace;
		}

		internal string GetQualifiedAttributeString(ObxmlDecodeState decodeState)
		{
			if (!string.IsNullOrEmpty(m_AttributeString))
			{
				return m_AttributeString;
			}
			GetQualifiedName(decodeState);
			m_AttributeString = " " + m_QualifiedName + "=\"" + Value + "\"";
			return m_AttributeString;
		}

		protected object Clone(ObxmlDecodeState decodeState, bool refetchPrefixInfo = false)
		{
			AttributeInfo attributeInfo = null;
			m_PrefixInfo = GetPrefixInfo(decodeState, refetchPrefixInfo);
			attributeInfo = decodeState.GetAttributeInfo();
			attributeInfo.ResetAttributeInfo(decodeState, m_nodeState, IsNamespaceAttribute, m_PrefixInfo, GetLocalName(decodeState), GetNamespace(decodeState), Value);
			if (!string.IsNullOrEmpty(Prefix))
			{
				attributeInfo.Prefix = Prefix;
			}
			return attributeInfo;
		}
	}
}
